package com.shanghaionstar.user.presenter;

import android.content.Context;

import com.onstar.cn.framework.mvp.base.IMVPScheduler;
import com.onstar.cn.framework.mvp.base.IMVPView;
import com.onstar.cn.framework.mvp.base.core.BasePresenter;
import com.onstar.cn.weight.DeleteEditText;
import com.shanghaionstar.activity.MoreActivity;
import com.shanghaionstar.user.FeedBackResult;
import com.shanghaionstar.user.iview.IFeedBackView;
import com.shanghaionstar.user.service.FeedBackService;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mengzhou Gu on 2016/8/8.
 */
public class FeedBackPresenter extends BasePresenter<FeedBackResult> {

    private IFeedBackView feedBackView;
    private Context context;
    private List<FeedBackService.ImgItem> imgList = new ArrayList<>();
    private DeleteEditText feedback_content;
    private FeedBackService service;


    public FeedBackPresenter(IMVPScheduler mvpScheduler,Context context,List<FeedBackService.ImgItem> imgList,DeleteEditText feedback_content) {
        super(mvpScheduler);
        this.context=context;
        this.imgList=imgList;
        this.feedback_content=feedback_content;
    }
/*
    @Override
    public void setView(FeedBackFragment view) {
        super.setView(view);
        feedBackView = (IFeedBackView) view;
        service = new FeedBackService(context, imgList, feedback_content);
        setServiceProvider(service);
    }*/

    @Override
    public void setView(IMVPView<FeedBackResult> view) {
        super.setView(view);
        feedBackView = (IFeedBackView) view;
        service = new FeedBackService(context, imgList, feedback_content);
        setServiceProvider(service);
    }

    public void showActionSheet() {
 /*       Message message = Message.obtain();
        message.what = MoreActivity.MsgWhats.SHOW_ACTIONSHEET_FEEDBACK;*/
        int showActionsheetFeedback = MoreActivity.SHOW_ACTIONSHEET_FEEDBACK;
        ((MoreActivity)feedBackView.onActivity()).showDialogToTakeChoosePicture(showActionsheetFeedback);
      /*  if (parentActivity instanceof MoreActivity)
            ((MoreActivity) parentActivity).handleMsg(message);*/
    }

}
